{% load i18n %}
<div class="btn-group hidden-print" role="group" aria-label="exports">
    {% if not noprint %}
        <a class="btn btn-default btn-sm" title="{% if print_label %}{{ print_label }}{% else %}{% blocktrans %}Imprimer{% endblocktrans %}{% endif %}"
            href="javascript:window.print()">
            <span class="glyphicon glyphicon-print" aria-hidden="true"></span>
        </a>
    {% endif %}
    {% if not printonly %}
        {% with 'ods xls csv' as formats %}
            {% for format in formats.split %}
                <a
                    class="btn btn-info btn-sm"
                    title="{% blocktrans %}Télécharger au format {{ format }}{% endblocktrans %}"
                    href="{% if seasonpk %}{% url exporturl seasonpk exportargs format %}{% elif year and season and exportargs %}{% url exporturl year season exportargs format %}{% elif year and season %}{% url exporturl year season format %}{% elif year and month %}{% url exporturl year month format %}{% else %}{% url exporturl exportargs format %}{% endif %}{% if filter_querystring %}?{{ filter_querystring }}{% endif %}"
                >
                    {% ifchanged %}
                        <span class="glyphicon glyphicon-floppy-save" aria-hidden="true"></span>
                    {% endifchanged %}
                    {{ format }}
                </a>
            {% endfor %}
        {% endwith %}
    {% endif %}
</div>

{% if pdf_file_name %}
    <script>
      window.addEventListener("beforeprint", (event) => {
        const fileName = "{{ pdf_file_name }}";
        document.getElementById("dv-title-non-print").innerHTML = document.title;
        document.title = fileName;
      });
      window.addEventListener("afterprint", (event) => {
        var initPageTitle = document.getElementById("dv-title-non-print").innerHTML;
        document.title = initPageTitle;
      });
    </script>
    <div id="dv-title-non-print" class="hidden"></div>
{% endif %}
